package com.chonglie;

import android.app.TabActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class TestTabActivity extends TabActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tab);

		TabHost tabs = getTabHost();
		TabSpec tab1 = tabs.newTabSpec("tab1");
		tab1.setIndicator("tab1");
		tab1.setContent(R.id.tab1);
		tabs.addTab(tab1);

		TabSpec tab2 = tabs.newTabSpec("tab2");
		tab2.setIndicator("tab2");
		tab2.setContent(R.id.tab2);
		tabs.addTab(tab2);

		tabs.setCurrentTab(0);
	}

	public void clickTab1Btn(View view) {
		EditText text = (EditText) findViewById(R.id.tab1_text);
		String str = text.getText().toString();
		text.setText(str + "," + str);
	}

	public void clickTab2Btn(View view) {
		EditText text = (EditText) findViewById(R.id.tab2_text);
		String str = text.getText().toString();
		text.setText(str + "," + str);
	}
}
